package com.googlecode.roleaccesscontrol.wicket;

import org.apache.wicket.Page;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
import org.apache.wicket.util.lang.PackageName;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

import com.googlecode.roleaccesscontrol.uc.application.ApplicationListPage;
import com.googlecode.roleaccesscontrol.uc.home.HomePage;
import com.googlecode.roleaccesscontrol.uc.user.UserListPage;

public class AccessControlApplication extends WebApplication {

	@Autowired
	protected ApplicationContext applicationContext;

	@Override
	protected void init() {
		super.init();
		addComponentInstantiationListener(new SpringComponentInjector(this, applicationContext,
				true));

		mount("home", PackageName.forClass(HomePage.class));
		mount("user", PackageName.forClass(UserListPage.class));
		mount("application", PackageName.forClass(ApplicationListPage.class));
	}

	@Override
	public Class<? extends Page> getHomePage() {
		return HomePage.class;
	}

}
